package com.atguigu.scala.test3

import org.junit.Test

import scala.io.{Source, StdIn}

/**
 * @author lizikuan
 * @date 2021/6/10 21:08
 */
class chapter1 {

  @Test
  def test1()={
    val str = new String("123dadsadasdas")
    println(str.substring(1))
    println(str.substring(1,5))
  }

  @Test
  def test2()={
    println("%d,%.2f,%s".format(12,11.1,"hello"))
    printf("%s,%d","hello",12)
  }

  @Test
  def test3()= {
    val str = StdIn.readLine("input:")
    println(Source.fromFile("datas/data1.txt").getLines().toList)
  }

  @Test
  def test4()={
    def func(age:Int*): Unit ={
      println(age.toList)
    }
//    func(List(1,2,3,4,5,6):_*)
    val intsToUnit = func _
    intsToUnit(List(1,2,3,4))
    def func2(op: => Int): Unit ={
      op
      println(op)
    }

    func2({
      println("1111")
      12
    })
  }
  
  

}
